.class public Lcom/instagram/creation/video/f/az;
.super Lcom/instagram/creation/video/f/ap;
.source "VideoScrubberFragmentJellybean.java"

# interfaces
.implements Landroid/graphics/SurfaceTexture$OnFrameAvailableListener;


# annotations
.annotation build Landroid/annotation/TargetApi;
    value = 0x10
.end annotation


# instance fields
.field private volatile Z:[Ljava/nio/ByteBuffer;

.field private volatile aa:Landroid/media/MediaFormat;

.field private ab:Landroid/media/MediaCodec$BufferInfo;

.field private volatile ac:J

.field private volatile ad:J

.field private g:Ljava/util/concurrent/ThreadPoolExecutor;

.field private volatile h:Landroid/media/MediaExtractor;

.field private volatile i:Landroid/media/MediaCodec;


# direct methods
.method public constructor <init>()V
    .locals 7

    .prologue
    const-wide/16 v3, 0x0

    const/4 v1, 0x1

    .line 22
    invoke-direct {p0}, Lcom/instagram/creation/video/f/ap;-><init>()V

    .line 27
    new-instance v0, Ljava/util/concurrent/ThreadPoolExecutor;

    sget-object v5, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;

    new-instance v6, Ljava/util/concurrent/LinkedBlockingQueue;

    invoke-direct {v6}, Ljava/util/concurrent/LinkedBlockingQueue;-><init>()V

    move v2, v1

    invoke-direct/range {v0 .. v6}, Ljava/util/concurrent/ThreadPoolExecutor;-><init>(IIJLjava/util/concurrent/TimeUnit;Ljava/util/concurrent/BlockingQueue;)V

    iput-object v0, p0, Lcom/instagram/creation/video/f/az;->g:Ljava/util/concurrent/ThreadPoolExecutor;

    .line 34
    new-instance v0, Landroid/media/MediaCodec$BufferInfo;

    invoke-direct {v0}, Landroid/media/MediaCodec$BufferInfo;-><init>()V

    iput-object v0, p0, Lcom/instagram/creation/video/f/az;->ab:Landroid/media/MediaCodec$BufferInfo;

    .line 36
    iput-wide v3, p0, Lcom/instagram/creation/video/f/az;->ac:J

    .line 37
    const-wide/16 v0, -0x1

    iput-wide v0, p0, Lcom/instagram/creation/video/f/az;->ad:J

    .line 141
    return-void
.end method

.method static synthetic a(Lcom/instagram/creation/video/f/az;Landroid/media/MediaCodec;)Landroid/media/MediaCodec;
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 22
    iput-object p1, p0, Lcom/instagram/creation/video/f/az;->i:Landroid/media/MediaCodec;

    return-object p1
.end method

.method static synthetic a(Lcom/instagram/creation/video/f/az;)Landroid/media/MediaExtractor;
    .locals 1
    .parameter

    .prologue
    .line 22
    iget-object v0, p0, Lcom/instagram/creation/video/f/az;->h:Landroid/media/MediaExtractor;

    return-object v0
.end method

.method static synthetic a(Lcom/instagram/creation/video/f/az;Landroid/media/MediaExtractor;)Landroid/media/MediaExtractor;
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 22
    iput-object p1, p0, Lcom/instagram/creation/video/f/az;->h:Landroid/media/MediaExtractor;

    return-object p1
.end method

.method static synthetic a(Lcom/instagram/creation/video/f/az;Landroid/media/MediaFormat;)Landroid/media/MediaFormat;
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 22
    iput-object p1, p0, Lcom/instagram/creation/video/f/az;->aa:Landroid/media/MediaFormat;

    return-object p1
.end method

.method static synthetic a(Lcom/instagram/creation/video/f/az;J)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 22
    invoke-direct {p0, p1, p2}, Lcom/instagram/creation/video/f/az;->b(J)V

    return-void
.end method

.method static synthetic a(Lcom/instagram/creation/video/f/az;[Ljava/nio/ByteBuffer;)[Ljava/nio/ByteBuffer;
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 22
    iput-object p1, p0, Lcom/instagram/creation/video/f/az;->Z:[Ljava/nio/ByteBuffer;

    return-object p1
.end method

.method static synthetic b(Lcom/instagram/creation/video/f/az;J)J
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 22
    iput-wide p1, p0, Lcom/instagram/creation/video/f/az;->ac:J

    return-wide p1
.end method

.method static synthetic b(Lcom/instagram/creation/video/f/az;)Landroid/media/MediaFormat;
    .locals 1
    .parameter

    .prologue
    .line 22
    iget-object v0, p0, Lcom/instagram/creation/video/f/az;->aa:Landroid/media/MediaFormat;

    return-object v0
.end method

.method private b(J)V
    .locals 2
    .parameter

    .prologue
    .line 40
    iget-wide v0, p0, Lcom/instagram/creation/video/f/az;->ad:J

    cmp-long v0, p1, v0

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/instagram/creation/video/f/az;->h:Landroid/media/MediaExtractor;

    if-eqz v0, :cond_0

    .line 41
    iget-object v0, p0, Lcom/instagram/creation/video/f/az;->h:Landroid/media/MediaExtractor;

    const/4 v1, 0x0

    invoke-virtual {v0, p1, p2, v1}, Landroid/media/MediaExtractor;->seekTo(JI)V

    .line 42
    invoke-virtual {p0, p1, p2}, Lcom/instagram/creation/video/f/az;->a(J)V

    .line 43
    iput-wide p1, p0, Lcom/instagram/creation/video/f/az;->ad:J

    .line 44
    iget-object v0, p0, Lcom/instagram/creation/video/f/az;->g:Ljava/util/concurrent/ThreadPoolExecutor;

    invoke-virtual {v0}, Ljava/util/concurrent/ThreadPoolExecutor;->getQueue()Ljava/util/concurrent/BlockingQueue;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/concurrent/BlockingQueue;->isEmpty()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 45
    invoke-virtual {p0}, Lcom/instagram/creation/video/f/az;->Y()V

    .line 48
    :cond_0
    return-void
.end method

.method static synthetic c(Lcom/instagram/creation/video/f/az;)Landroid/media/MediaCodec;
    .locals 1
    .parameter

    .prologue
    .line 22
    iget-object v0, p0, Lcom/instagram/creation/video/f/az;->i:Landroid/media/MediaCodec;

    return-object v0
.end method

.method static synthetic d(Lcom/instagram/creation/video/f/az;)J
    .locals 2
    .parameter

    .prologue
    .line 22
    iget-wide v0, p0, Lcom/instagram/creation/video/f/az;->ac:J

    return-wide v0
.end method

.method static synthetic e(Lcom/instagram/creation/video/f/az;)Ljava/util/concurrent/ThreadPoolExecutor;
    .locals 1
    .parameter

    .prologue
    .line 22
    iget-object v0, p0, Lcom/instagram/creation/video/f/az;->g:Ljava/util/concurrent/ThreadPoolExecutor;

    return-object v0
.end method


# virtual methods
.method public a(J)V
    .locals 18
    .parameter

    .prologue
    .line 68
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v15

    .line 69
    const/4 v9, 0x1

    .line 70
    const/4 v14, 0x0

    .line 71
    const-wide/16 v10, -0x1

    .line 73
    :goto_0
    if-eqz v9, :cond_0

    move-object/from16 v0, p0

    iget-wide v2, v0, Lcom/instagram/creation/video/f/az;->ac:J

    cmp-long v2, p1, v2

    if-nez v2, :cond_0

    .line 74
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/instagram/creation/video/f/az;->f:Ljava/lang/Object;

    move-object/from16 v17, v0

    monitor-enter v17

    .line 75
    :try_start_0
    move-object/from16 v0, p0

    iget-boolean v2, v0, Lcom/instagram/creation/video/f/az;->e:Z

    if-nez v2, :cond_1

    .line 76
    monitor-exit v17
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 122
    :cond_0
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v2

    .line 123
    const-string v4, "VideoScrubberFragmentJellybean"

    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    const-string v6, "Took "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    sub-long/2addr v2, v15

    invoke-virtual {v5, v2, v3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, " ms to decode and render frame"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v4, v2}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 124
    :goto_1
    return-void

    .line 78
    :cond_1
    :try_start_1
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/instagram/creation/video/f/az;->i:Landroid/media/MediaCodec;

    const-wide/16 v3, 0x2710

    invoke-virtual {v2, v3, v4}, Landroid/media/MediaCodec;->dequeueInputBuffer(J)I

    move-result v3

    .line 79
    if-ltz v3, :cond_9

    .line 80
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/instagram/creation/video/f/az;->Z:[Ljava/nio/ByteBuffer;

    if-nez v2, :cond_2

    .line 81
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/instagram/creation/video/f/az;->i:Landroid/media/MediaCodec;

    invoke-virtual {v2}, Landroid/media/MediaCodec;->getInputBuffers()[Ljava/nio/ByteBuffer;

    move-result-object v2

    move-object/from16 v0, p0

    iput-object v2, v0, Lcom/instagram/creation/video/f/az;->Z:[Ljava/nio/ByteBuffer;

    .line 83
    :cond_2
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/instagram/creation/video/f/az;->Z:[Ljava/nio/ByteBuffer;

    if-nez v2, :cond_3

    .line 84
    monitor-exit v17

    goto :goto_1

    .line 120
    :catchall_0
    move-exception v2

    monitor-exit v17
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw v2

    .line 86
    :cond_3
    :try_start_2
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/instagram/creation/video/f/az;->h:Landroid/media/MediaExtractor;

    move-object/from16 v0, p0

    iget-object v4, v0, Lcom/instagram/creation/video/f/az;->Z:[Ljava/nio/ByteBuffer;

    aget-object v4, v4, v3

    const/4 v5, 0x0

    invoke-virtual {v2, v4, v5}, Landroid/media/MediaExtractor;->readSampleData(Ljava/nio/ByteBuffer;I)I

    move-result v5

    .line 87
    if-gez v5, :cond_4

    .line 89
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/instagram/creation/video/f/az;->i:Landroid/media/MediaCodec;

    const/4 v4, 0x0

    const/4 v5, 0x0

    const-wide/16 v6, 0x0

    const/4 v8, 0x0

    invoke-virtual/range {v2 .. v8}, Landroid/media/MediaCodec;->queueInputBuffer(IIIJI)V

    .line 93
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/instagram/creation/video/f/az;->h:Landroid/media/MediaExtractor;

    const-wide/16 v3, 0x0

    const/4 v5, 0x2

    invoke-virtual {v2, v3, v4, v5}, Landroid/media/MediaExtractor;->seekTo(JI)V

    .line 94
    const/4 v2, 0x1

    move-wide v3, v10

    move v5, v2

    .line 106
    :goto_2
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/instagram/creation/video/f/az;->i:Landroid/media/MediaCodec;

    move-object/from16 v0, p0

    iget-object v6, v0, Lcom/instagram/creation/video/f/az;->ab:Landroid/media/MediaCodec$BufferInfo;

    const-wide/16 v7, 0x2710

    invoke-virtual {v2, v6, v7, v8}, Landroid/media/MediaCodec;->dequeueOutputBuffer(Landroid/media/MediaCodec$BufferInfo;J)I

    move-result v6

    .line 107
    const/4 v2, -0x3

    if-ne v6, v2, :cond_5

    move v2, v9

    .line 120
    :goto_3
    monitor-exit v17

    move-wide v10, v3

    move v14, v5

    move v9, v2

    goto/16 :goto_0

    .line 96
    :cond_4
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/instagram/creation/video/f/az;->h:Landroid/media/MediaExtractor;

    invoke-virtual {v2}, Landroid/media/MediaExtractor;->getSampleTime()J

    move-result-wide v12

    .line 97
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/instagram/creation/video/f/az;->i:Landroid/media/MediaCodec;

    const/4 v4, 0x0

    move-object/from16 v0, p0

    iget-object v6, v0, Lcom/instagram/creation/video/f/az;->h:Landroid/media/MediaExtractor;

    invoke-virtual {v6}, Landroid/media/MediaExtractor;->getSampleTime()J

    move-result-wide v6

    const/4 v8, 0x0

    invoke-virtual/range {v2 .. v8}, Landroid/media/MediaCodec;->queueInputBuffer(IIIJI)V

    .line 99
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/instagram/creation/video/f/az;->h:Landroid/media/MediaExtractor;

    invoke-virtual {v2}, Landroid/media/MediaExtractor;->advance()Z

    .line 100
    if-nez v14, :cond_9

    const-wide/16 v2, -0x1

    cmp-long v2, v12, v2

    if-eqz v2, :cond_9

    move-wide v3, v12

    move v5, v14

    .line 101
    goto :goto_2

    .line 108
    :cond_5
    if-ltz v6, :cond_8

    .line 111
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/instagram/creation/video/f/az;->ab:Landroid/media/MediaCodec$BufferInfo;

    iget-wide v7, v2, Landroid/media/MediaCodec$BufferInfo;->presentationTimeUs:J

    cmp-long v2, v7, p1

    if-gez v2, :cond_6

    if-eqz v5, :cond_7

    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/instagram/creation/video/f/az;->ab:Landroid/media/MediaCodec$BufferInfo;

    iget-wide v7, v2, Landroid/media/MediaCodec$BufferInfo;->presentationTimeUs:J

    cmp-long v2, v7, v3

    if-ltz v2, :cond_7

    :cond_6
    const/4 v2, 0x1

    .line 113
    :goto_4
    move-object/from16 v0, p0

    iget-object v7, v0, Lcom/instagram/creation/video/f/az;->i:Landroid/media/MediaCodec;

    invoke-virtual {v7, v6, v2}, Landroid/media/MediaCodec;->releaseOutputBuffer(IZ)V

    .line 114
    if-eqz v2, :cond_8

    .line 115
    const-string v2, "VideoScrubberFragmentJellybean"

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    const-string v7, "Requested "

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    move-wide/from16 v0, p1

    invoke-virtual {v6, v0, v1}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v6

    const-string v7, ", but displaying "

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    move-object/from16 v0, p0

    iget-object v7, v0, Lcom/instagram/creation/video/f/az;->ab:Landroid/media/MediaCodec$BufferInfo;

    iget-wide v7, v7, Landroid/media/MediaCodec$BufferInfo;->presentationTimeUs:J

    invoke-virtual {v6, v7, v8}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v2, v6}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 116
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/instagram/creation/video/f/az;->i:Landroid/media/MediaCodec;

    invoke-virtual {v2}, Landroid/media/MediaCodec;->flush()V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    .line 117
    const/4 v2, 0x0

    goto/16 :goto_3

    .line 111
    :cond_7
    const/4 v2, 0x0

    goto :goto_4

    :cond_8
    move v2, v9

    goto/16 :goto_3

    :cond_9
    move-wide v3, v10

    move v5, v14

    goto/16 :goto_2
.end method

.method public b(Lcom/instagram/creation/video/gl/l;)V
    .locals 1
    .parameter

    .prologue
    .line 138
    new-instance v0, Lcom/instagram/creation/video/f/bb;

    invoke-direct {v0, p0, p1}, Lcom/instagram/creation/video/f/bb;-><init>(Lcom/instagram/creation/video/f/az;Lcom/instagram/creation/video/gl/l;)V

    iput-object v0, p0, Lcom/instagram/creation/video/f/az;->b:Lcom/instagram/creation/video/f/as;

    .line 139
    return-void
.end method

.method public onFrameAvailable(Landroid/graphics/SurfaceTexture;)V
    .locals 1
    .parameter "surfaceTexture"

    .prologue
    .line 128
    iget-object v0, p0, Lcom/instagram/creation/video/f/az;->b:Lcom/instagram/creation/video/f/as;

    if-eqz v0, :cond_0

    .line 129
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/instagram/creation/video/f/az;->c:Z

    .line 130
    iget-object v0, p0, Lcom/instagram/creation/video/f/az;->b:Lcom/instagram/creation/video/f/as;

    invoke-virtual {v0}, Lcom/instagram/creation/video/f/as;->m()V

    .line 131
    iget-boolean v0, p0, Lcom/instagram/creation/video/f/az;->d:Z

    if-eqz v0, :cond_0

    .line 132
    iget-object v0, p0, Lcom/instagram/creation/video/f/az;->b:Lcom/instagram/creation/video/f/as;

    invoke-virtual {v0}, Lcom/instagram/creation/video/f/as;->k()V

    .line 135
    :cond_0
    return-void
.end method

.method public onProgressChanged(Landroid/widget/SeekBar;IZ)V
    .locals 4
    .parameter "seekBar"
    .parameter "progress"
    .parameter "fromUser"

    .prologue
    .line 52
    if-eqz p3, :cond_0

    iget-object v0, p0, Lcom/instagram/creation/video/f/az;->a:Lcom/instagram/pendingmedia/model/a;

    if-eqz v0, :cond_0

    .line 53
    iget-object v0, p0, Lcom/instagram/creation/video/f/az;->a:Lcom/instagram/pendingmedia/model/a;

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/model/a;->h()I

    move-result v0

    mul-int/2addr v0, p2

    mul-int/lit8 v0, v0, 0xa

    iget-object v1, p0, Lcom/instagram/creation/video/f/az;->a:Lcom/instagram/pendingmedia/model/a;

    invoke-virtual {v1}, Lcom/instagram/pendingmedia/model/a;->f()I

    move-result v1

    mul-int/lit16 v1, v1, 0x3e8

    add-int/2addr v0, v1

    int-to-long v0, v0

    iput-wide v0, p0, Lcom/instagram/creation/video/f/az;->ac:J

    .line 55
    invoke-virtual {p0}, Lcom/instagram/creation/video/f/az;->X()V

    .line 56
    iget-wide v0, p0, Lcom/instagram/creation/video/f/az;->ac:J

    .line 57
    iget-object v2, p0, Lcom/instagram/creation/video/f/az;->g:Ljava/util/concurrent/ThreadPoolExecutor;

    invoke-virtual {v2}, Ljava/util/concurrent/ThreadPoolExecutor;->getQueue()Ljava/util/concurrent/BlockingQueue;

    move-result-object v2

    invoke-interface {v2}, Ljava/util/concurrent/BlockingQueue;->clear()V

    .line 58
    iget-object v2, p0, Lcom/instagram/creation/video/f/az;->g:Ljava/util/concurrent/ThreadPoolExecutor;

    invoke-virtual {v2}, Ljava/util/concurrent/ThreadPoolExecutor;->getQueue()Ljava/util/concurrent/BlockingQueue;

    move-result-object v2

    new-instance v3, Lcom/instagram/creation/video/f/ba;

    invoke-direct {v3, p0, v0, v1}, Lcom/instagram/creation/video/f/ba;-><init>(Lcom/instagram/creation/video/f/az;J)V

    invoke-interface {v2, v3}, Ljava/util/concurrent/BlockingQueue;->add(Ljava/lang/Object;)Z

    .line 65
    :cond_0
    return-void
.end method

.method public y()V
    .locals 1

    .prologue
    .line 217
    invoke-super {p0}, Lcom/instagram/creation/video/f/ap;->y()V

    .line 219
    iget-object v0, p0, Lcom/instagram/creation/video/f/az;->g:Ljava/util/concurrent/ThreadPoolExecutor;

    invoke-virtual {v0}, Ljava/util/concurrent/ThreadPoolExecutor;->getQueue()Ljava/util/concurrent/BlockingQueue;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/concurrent/BlockingQueue;->clear()V

    .line 220
    return-void
.end method
